package utils

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/theme"
	_ "unsafe"
)

//go:linkname createTextDialog  fyne.io/fyne/v2/dialog.createTextDialog
func createTextDialog(title, message string, icon fyne.Resource, parent fyne.Window) dialog.Dialog

// info弹窗
func InfoDialog(title, content string, parent fyne.Window) {
	//information := dialog.NewInformation(title, content, core.TopWin)
	//information.Show()
	createTextDialog(title, content, theme.CheckButtonCheckedIcon(), parent).Show()
}

// error弹窗
func ErrorDialog(title, content string, parent fyne.Window) {
	createTextDialog(title, content, theme.CancelIcon(), parent).Show()
}

// 警告弹窗
func WarningDialog(title, content string, parent fyne.Window) {
	createTextDialog(title, content, theme.WarningIcon(), parent).Show()
}
